﻿using System.Net;
using System.Net.Sockets;

namespace Oblivion.Networking
{
    /// <summary>
    /// This class contains socket and client information for the player. It doesn't matter what server the 
    /// client is from, it's an object, so we're going to handle it as an object until the sever invokes
    /// the socket events.
    /// </summary>
    public class Passport
    {
        // Passport Information :D
        public byte[] Buffer; // The current packet being read in by the server's socket system.
        public object Client; // The client being handled for packet processing.
        public Socket Socket; // The server-managed client socket for handling communications with the client.

        /// <summary>
        /// This class contains socket and client information for the player. It doesn't matter what server the 
        /// client is from, it's an object, so we're going to handle it as an object until the sever invokes
        /// the socket events.
        /// </summary>
        /// <param name="socket">The server-managed client socket, used to handle communications with the client.</param>
        public Passport(Socket socket)
        {
            Socket = socket;
        }

        /// <summary>
        /// Returns the ip address of the passport!
        /// </summary>
        public override string ToString()
        {
            return (Socket.RemoteEndPoint as IPEndPoint).Address.ToString();
        }
    }
}